package com.power.controller;

import com.alibaba.fastjson.JSON;
import com.power.ov.ResultData;
import com.power.service.TowerService;
import com.power.service.impl.TowerServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

/**
 * Created with IntelliJ IDEA.
 * User: 李辽
 * Date: 2020/10/11 12:10
 * Description:通过线路id查询其下所有的杆塔信息
 * Version: V1.0
 */
@WebServlet("/DefectSelect.do")
public class DefectSelect extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String line_id = request.getParameter("line_id");
        TowerService towerService = new TowerServiceImpl();
        ResultData resultData = new ResultData();
        try {
            resultData  = towerService.DefectSelect(line_id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        response.getWriter().write(JSON.toJSONString(resultData));
        response.getWriter().flush();
        response.getWriter().close();
    }
}











